package com.example.openfeignclient;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description:
 * @Author WuGang
 * @Date 2022/11/14 10:01
 * @Version 1.0
 */
@Controller
@RequestMapping("/openfeign")
public class B {
    @Autowired
    A a;

    @GetMapping("/client/test")
    @ResponseBody
    public String clienttest() {
//        如果不开启b的调用服务那么这里就会报错   直接debug能进源码
        String test = a.test();
        return "openfeign调用结果" + test;
    }

    @GetMapping("/client/test2")
    @ResponseBody //返回JSON必要
    public String clienttest2() {
        return "test2";
    }

    @GetMapping("/client/test3")
    @ResponseBody
    public String clienttest3() {
//        本服务自己调自己  充当提供方和调用方
        String test = a.test2();
        return "openfeign调用结果" + test;
    }
}
